package com.example.onlineeducation.mapper

import com.example.onlineeducation.data.entity.UserProJoinInfoEntity
import com.example.onlineeducation.data.entity.UserProStudyTimeEntity
import com.example.onlineeducation.data.json.UserProJoinInfoJson
import com.example.onlineeducation.data.json.UserProStudyTimeJson
import com.example.onlineeducation.utils.YcTimeUtils
import com.yc.jetpacklib.extension.ycToNoEmptyHasUnit
import com.yc.jetpacklib.extension.ycToStringNoEmpty
import com.yc.jetpacklib.mapper.IMapper

class UserProJoinInfoMapper : IMapper<UserProJoinInfoJson?, UserProJoinInfoEntity> {
    override fun map(input: UserProJoinInfoJson?): UserProJoinInfoEntity {
        return if (input != null) {
            UserProJoinInfoEntity(
                input.activeNum.ycToStringNoEmpty("0"),
                input.examPassNum.ycToStringNoEmpty("0"),
                input.allExamNum.ycToStringNoEmpty("0")
            )
        } else {
            UserProJoinInfoEntity("0", "0", "0")
        }
    }
}

